import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/exon',
    name: 'exoneration',
    component: () => import('../views/Exoneration.vue'),
  },
  {
    path: '/Myshoucang',
    name: 'routeName',
    component: () => import('../views/Myshoucang.vue'),
  },
  {
    path: '/zhifu',
    name: 'zhifu',
    component: () => import('../views/ZhiFu.vue'),
  },
  {
    path: '/sousuo/:value?',
    props:true,
    name: '搜索页',
    component: () => import('../views/Sousuo.vue'),
  },
  {
    path: '/shopping',
    name: '购买页面',
    component: () => import('../views/shopp.vue'),
  },
  {
    path: '/gl',
    name: 'gonglue',
    component: () => import('../views/GongLue.vue'),
  },
  {
    path: '/history',
    name: '历史通知',
    component: () => import('../views/History.vue'),
  },
  {
    path: '/menpiao',
    name: 'routeName',
    component: () => import('../views/MenPiao.vue'),
  },

  {
    path: '/daoyou',
    name: '导游',
    component: () => import('../views/DaoYou.vue'),
  },
  {
    path: '/gentuan',
    name: '跟团游',
    component: () => import('../views/GenTuan.vue'),
  },
  {
    path: '/porduct',
    name: 'gouwuche',
    component: () => import('../views/porduct.vue'),
  },
  {
    path: '/',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue'),
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
  },
  {
    path: '/IndiviDual',
    props:true,
    name: 'login',
    component: () => import('../views/IndiviDual.vue'),
  },
  {
    path: '/dingdan',
    name: '订单',
    component: () => import('../views/dingdan.vue'),
  },
  {
    path: '/weizhifu',
    name: '未支付',
    component: () => import('../views/WeiZhiFu.vue'),
  },
  {
    path: '/tuikuan',
    name: '删除',
    component: () => import('../views/TuiKuan.vue'),
  },
  {
    path: '/porduct',
    name: 'porduct',
    component: () => import('../views/porduct.vue'),
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,

  //return期望滚动到那个位置
  //return {x:0,y:0}
  scrollBehavior (to, from, savedPosition){ 
    if (savedPosition) { 
  return savedPosition 
     } else { return { x: 0, y: 0 } } }
})

export default router
